class Solution(object):
    def moveZeroes(self, nums):
        """
        :type nums: List[int]
        :rtype: None Do not return anything, modify nums in-place instead.
        """
        fnp = 0
        fzp = 0
        nums_len = len(nums)
        while fzp < nums_len and fnp < nums_len:
            while fzp < nums_len and nums[fzp] != 0:
                fzp += 1
            if fnp < fzp:
                fnp = fzp + 1
            while fnp < nums_len and nums[fnp] == 0:
                fnp += 1
            if fzp < fnp and fnp < nums_len:
                nums[fzp], nums[fnp] = nums[fnp], nums[fzp]
            fzp += 1
            fnp += 1


s = Solution()
nums = [0,1,0,3,12]
s.moveZeroes(nums)
print(nums)

nums = [0]
s.moveZeroes(nums)
print(nums)
